<template>
  <div class="video">
    <headerNav></headerNav>

    <div class="Content">
      <div class="content" v-for="(item, index) in videos" :key="index">
        <div class="title">
          <div class="userimg">
            <img :src="item.r.a.p" alt="" />
          </div>
          <div class="username">{{ item.r.a.n }}</div>
          <div class="lv">LV.{{ item.r.a.lvl }}</div>
        </div>

        <div class="img" @click="To(item.r.id, item.r.vu)">
          <video :src="item.r.vu"></video>
          <div class="play">
            <div class="iconfont icon-bofang1"></div>
          </div>
        </div>

        <div class="Collection">
          <div class="items">
            <div
              class="item"
              v-for="value in item.r.collect_users"
              :key="value.id"
            >
              <img :src="value.p" alt="" />
            </div>

            <div class="num">{{ item.r.collect_count_text }}</div>
          </div>
          <div
            :class="[
              'iconfont',
              icon ? 'icon-shoucang' : 'icon-shoucang-tianchong',
            ]"
            @click.stop="toggle"
          ></div>
        </div>
        <div class="buttom">{{ item.r.n }}</div>
      </div>
    </div>

    <!-- 底部导航 -->
    <footNav> </footNav>
  </div>
</template>

<script>
import footNav from "../base/footNav.vue";
import headerNav from "../base/headerNav.vue";

import { getVideos } from "../../api/home";
// import axios from "axios";
export default {
  data() {
    return {
      videos: null,
      icon: true,
    };
  },
  methods: {
    getVideosFun() {
      getVideos().then((data) => {
        this.videos = data.result.list;
        console.log(this.videos);
      });
    },
    toggle() {
      this.icon = !this.icon;
    },
    To(id, video) {
      this.$router.push({
        path: "/recipe/videolist",
        query: { id: id, video: video },
      });
    },
  },
  created() {
    this.getVideosFun();
  },

  components: {
    headerNav,
    footNav,
  },
};
</script>
<style lang="less">
.video {
  .Content {
    margin-bottom: 70px;
    .content {
      .title {
        display: flex;
        align-items: center;
        margin-bottom: 8px;
        .userimg {
          width: 30px;
          height: 30px;
          border-radius: 50%;
          margin-left: 10px;
          img {
            width: 30px;
            height: 30px;
            border-radius: 50%;
          }
        }
        .username {
          color: #343434;
          font-size: 10px;
          font-weight: bold;
          margin: 0 10px;
        }
        .lv {
          color: #fdc837;
          font-size: 10px;
          font-weight: bold;
        }
      }
      .img {
        position: relative;
        width: 100%;
        margin-bottom: 8px;
        video {
          width: 100%;
        }
      }
      .play {
        position: absolute;
        bottom: 10px;
        right: 15px;
        text-align: center;
        width: 25px;
        height: 25px;
        border-radius: 50%;
        background: #000;
        opacity: 0.5;
        .iconfont {
          font-size: 8px;
          color: #fff;
          line-height: 25px;
          margin: 0 8px;
          opacity: 1;
        }
      }
      .Collection {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin: 0 10px;
        margin-bottom: 15px;
        .items {
          // position: relative;
          display: flex;
          .item {
            // position: absolute;
            width: 15px;
            height: 15px;
            border-radius: 50%;
            img {
              width: 15px;
              height: 15px;
              border-radius: 50%;
            }
          }
        }
        .num {
          font-weight: bold;
          margin-left: 8px;
          color: #010101;
          font-size: 12px;
        }
        .iconfont {
          font-size: 22px;
          font-weight: bold;
        }
        .icon-shoucang-tianchong {
          color: #fdc837;
        }
      }
      .buttom {
        color: #1d1d1d;
        font-size: 12px;
        margin-left: 10px;
        margin-bottom: 20px;
      }
    }
  }
}
</style>